package com.ccc.service.impl;

import com.ccc.dto.Result;
import com.ccc.entity.ShopType;
import com.ccc.mapper.ShopTypeMapper;
import com.ccc.service.IShopTypeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ccc.utils.RedisConstants;
import org.springframework.boot.autoconfigure.cache.CacheProperties;
import org.springframework.data.redis.core.ListOperations;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 虎哥
 * @since 2021-12-22
 */
@Service
public class ShopTypeServiceImpl extends ServiceImpl<ShopTypeMapper, ShopType> implements IShopTypeService {

    private final StringRedisTemplate stringRedisTemplate;

    public ShopTypeServiceImpl(StringRedisTemplate stringRedisTemplate) {
        this.stringRedisTemplate = stringRedisTemplate;
    }

    @Override
    public Result queryList() {
        String key = RedisConstants.SHOP_TYPE_KEY ;
        //查询缓存
//        ListOperations<String,ShopType> typeList = stringRedisTemplate.opsForList();
//        List<ShopType> typeList = query().orderByAsc("sort").list();
        //成功:返回
        return Result.fail("falfl");
        //失败:查询数据库
        //失败:401
        //成功:添加缓存,返回
    }
}
